﻿function ResizeIFrame(splitHeight) {

    $('#ASPxPageControl1_CC').height(splitHeight - $('#ASPxPageControl1_TC').height() -6);

    var length = $("#ASPxPageControl1_CC > div:visible").attr("id").replace("ASPxPageControl1_C", "");
    //
    if ($("#iframeStdQuery" + length).length == 1) {
        $("#iframeStdQuery" + length)[0].contentWindow.ResizeIFrame($('#ASPxPageControl1_CC').height());
        $("#ASPxPageControl1_TC").width($(self.frameElement).parent().width());
        $("#iframeStdQuery" + length).height($('#ASPxPageControl1_CC').height());
    } //else if ($("#iframeDataObject"+length).length==1){}
}

$("#ASPxPageControl1_TC").css("display", "block").css("overflow", "hidden").prepend($("#img_tabPrev")).append($("#img_tabNext"));

//开始，移动TAB
var tabTable = $("#ASPxPageControl1_TC > table");
$("#img_tabPrev,#img_tabNext").hover(function () {
    var iframeWidth = parent.$("#iframeContent").width();
    if (tabTable.width() > iframeWidth) $(this).css("opacity", "1");
}, function () {
    var iframeWidth = parent.$("#iframeContent").width();
    if (tabTable.width() > iframeWidth) $(this).css("opacity", "0.5");
});

tabTable.css("margin-left", "0px").css("margin-right", "0px;");

var intervalFlagPrev, intervalFlagNext;
$("#img_tabPrev").mousedown(function () {
    intervalFlagNext = setInterval(function () {
        var left = tabTable.css("margin-left").replace("px", "");
        if (left == "0") { clearInterval(intervalFlagNext); return; }
        $("#ASPxPageControl1_TC > table").css("margin-left", ((parseInt(left) + 1) + "px"));
    }, 1);


}).mouseup(function () {
    clearInterval(intervalFlagNext);
});

$("#img_tabNext").mousedown(function () {
    var iframeWidth = $(self.frameElement).parent().width() + 1;
    intervalFlagPrev = setInterval(function () {
        var left = tabTable.css("margin-left").replace("px", "");
        if (iframeWidth >= (tabTable.width() + parseInt(left) + 1)) { clearInterval(intervalFlagPrev); return; }

        tabTable.css("margin-left", ((left - 1) + "px"));
    }, 1);
}).mouseup(function () {
    clearInterval(intervalFlagPrev);
});
//结束，移动TAB


$("#ASPxPageControl1_CC").css("border-style", "none");